<template>
	<view>
		<view class="activity-list">

			<view v-for="(item,index) in list" class="item" :key="index">

				<view class="title">{{item.theme}}</view>
				<view>活动时间时间：{{item.starttime}}</view>
				<view>地点：{{item.address}}</view>
				<view >人数：{{item.join_total_member}}/{{item.min_member}}</view>
				
				<view style="display: flex;justify-content: space-between;">
					<view style="width: 400rpx;">
						<u--text v-if="item.event_status == 0" type="primary" size="13" text="组局中"></u--text>
						<u--text v-if="item.event_status == 1" type="error" size="13" text="成局"></u--text>
					</view>
					
					<button class="youqu-color" size="mini" @click="gotoDetail(item)">查看</button>
				</view>

			</view>
		</view>

		<u-empty mode="list" :show="this.list.length == 0"></u-empty>
	</view>

</template>

<script>
	import * as EventApi from '@/api/event.js';
	export default {
		props: {
			member_nid: {
				type: Number
			},
			type: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {
				page: 1,
				list: []
			}
		},
		created() {

		},
		mounted(){
			if (this.type == 0) {
				this.getList()
			} else {
				this.getManageList()
			}
			
		},

		methods: {

			gotoDetail(item) {
				
				if (item.is_over == 1) {
					uni.navigateTo({
						url: '/pages/myactivity/detail?id=' + item.nid
					})
				} else {
					uni.navigateTo({
						url: '/pages/activity/detail?id=' + item.nid
					})
				}
				
			},
			getList() {
				let that = this;
				EventApi.user_list({
					member_nid: this.member_nid
				}).then(res => {
					that.list = res.info
				})

			},
			getManageList() {
				let that = this;
				EventApi.manage_list({
					member_nid: this.member_nid
				}).then(res => {
					that.list = res.info
				})

			},
		}
	}
</script>

<style scoped lang="scss">
	.activity-list {
		.item {
			padding: 20rpx;
			border-radius: 15rpx;
			background-color: #FFFFFF;
			margin-top: 40rpx;
			box-shadow: 0 0 15rpx #C0C0C0;
			font-size: 26rpx;
			color: #C0C0C0;

			.title {
				font-size: 32rpx;
				font-weight: bold;
				color: #000;
			}

			.youqu-color {
				background-color: #ffd91d;
			}
		}

	}
</style>